Conversation
SchubertS96
reviewed
Nov 22, 2023
| print("*********************************************") | ||
|
|
||
| for b in self.get_books(): | ||
| if Genre.CRIME in b.genres: |
Collaborator
There was a problem hiding this comment.
combine the two if statements to one if statement
SchubertS96
reviewed
Nov 22, 2023
| max = b | ||
| # end if | ||
| # end if | ||
| else: |
Collaborator
There was a problem hiding this comment.
Else branch not necessary
SchubertS96
reviewed
Nov 22, 2023
|
|
||
| # Prints crime audio books | ||
| def print_longest_crime_audio_book(self) -> str: | ||
| crime_audio_books: list[Book] = [] |
Collaborator
There was a problem hiding this comment.
Variable is never used
SchubertS96
reviewed
Nov 22, 2023
| for b in self.get_books(): | ||
| if Genre.CRIME in b.genres: | ||
| if b._book_type == "Audio": | ||
| if max is not None and max.duration < b.duration: |
Collaborator
There was a problem hiding this comment.
There is a bug here, it should be "max is None or max.duration < b.duration"
Collaborator
There was a problem hiding this comment.
Also, there may be multiple books of the same maximum length. Then, only the first one is actually printed out.
SchubertS96
reviewed
Nov 22, 2023
| print(f"Title: {max.title}") | ||
| print(f"Author: {max.authors}") | ||
| print(f"Duration: {max.duration}") | ||
| print(f"______________________________") |
Collaborator
There was a problem hiding this comment.
Maybe add the other variables of book to the printout
SchubertS96
reviewed
Nov 22, 2023
| print(f"Duration: {max.duration}") | ||
| print(f"______________________________") | ||
| return str(max) | ||
|
|
Collaborator
There was a problem hiding this comment.
The constructor and the class variable should be above the print function in our opinion for better readability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.